home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb.new / gdb-4.0 / gdb / configure < prev    next >
Encoding:
Text File  |  1991-08-24  |  23.8 KB  |  953 lines

  1. #!/bin/sh
  2. # Please do not edit this file.  It is generated automatically from
  3. # configure.in and a configure template.
  4. configdirs=
  5.  
  6. #!/bin/sh
  7.  
  8. # Configuration script template
  9. #   Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
  10.  
  11. #This file is part of GNU.
  12.  
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version.
  17. # This program is distributed in the hope that it will be useful,
  18. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. # GNU General Public License for more details.
  21. # You should have received a copy of the GNU General Public License
  22. # along with this program; if not, write to the Free Software
  23. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  24.  
  25. # $Id: configure,v 1.31 1991/08/23 04:50:57 rich Exp $
  26.  
  27. #
  28. # Shell script to create proper links to machine-dependent files in
  29. # preparation for compilation.
  30. #
  31. # If configure succeeds, it leaves its status in config.status.
  32. # If configure fails after disturbing the status quo, 
  33. #     config.status is removed.
  34. #
  35.  
  36. remove=rm
  37. hard_link=ln
  38. symbolic_link='ln -s'
  39.  
  40. #for Test
  41. #remove="echo rm"
  42. #hard_link="echo ln"
  43. #symbolic_link="echo ln -s"
  44.  
  45. progname=$0
  46.  
  47. # clear some things potentially inherited from environment.
  48. ansi=
  49. defaulttargets=
  50. destdir=
  51. fatal=
  52. hostsubdir=
  53. Makefile=Makefile
  54. Makefile_in=Makefile.in
  55. norecurse=
  56. recursing=
  57. removing=
  58. srcdir=
  59. srctrigger=
  60. target=
  61. targets=
  62. commontargets=
  63. targetsubdir=
  64. template=
  65. verbose=
  66.  
  67. for arg in $*;
  68. do
  69.     case ${arg} in
  70.     -ansi | +a*)
  71.         ansi=true
  72.         clib=clib
  73.         ;;
  74.     -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*)
  75.         destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'`
  76.         ;;
  77.     -languages=* | +languages=* | +language=* | +languag=* \
  78.         | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
  79.         | +l=*)
  80.         languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`"
  81.         ;;
  82.     -gas | +g*)
  83.         gas=yes
  84.         ;;
  85.     -help | +h*)
  86.         fatal=true
  87.         ;;
  88.     -nfp | +nf*)
  89.         nfp=yes
  90.         ;;
  91.     -norecurse | +no*)
  92.         norecurse=true
  93.         ;;
  94.     -recursing)
  95.         recursing=true
  96.         ;;
  97.     -rm | +r*)
  98.         removing=${arg}
  99.         ;;
  100. #    -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
  101. #        srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'`
  102. #        ;;
  103.     -subdirs | +f* | +su*)
  104.         subdirs=${arg}
  105.         ;;
  106.     -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*)
  107.         if [ -n "${targets}" ] ; then
  108.             subdirs="+subdirs"
  109.         fi
  110.  
  111.         newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`"
  112.         targets="${newtargets}"
  113.         ;;
  114.     -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*)
  115.         template=`echo ${arg} | sed 's/[+-]template=//'`
  116.         ;;
  117.     -v | -verbose | +v*)
  118.         verbose=${arg}
  119.         ;;
  120.     -* | +*)
  121.         (echo ;
  122.         echo "Unrecognized option: \"${arg}\"". ;
  123.         echo) 1>&2
  124.         fatal=true
  125.         ;;
  126.     *)
  127.         if [ -n "${hosts}" ] ; then
  128.             subdirs="+subdirs"
  129.         fi
  130.  
  131.         newhosts="${hosts} ${arg}"
  132.         hosts=${newhosts}
  133.         ;;
  134.     esac
  135. done
  136.  
  137. if [ -n "${verbose}" ] ; then
  138.     echo `pwd`/configure $*
  139. fi
  140.  
  141. # process host and target only if not rebuilding configure itself or removing.
  142. if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then
  143.     # Complain if an arg is missing
  144.     if [ -z "${hosts}" ] ; then
  145.         (echo ;
  146.         echo "configure: No HOST specified." ;
  147.         echo) 1>&2
  148.         fatal=true
  149.     fi
  150. fi
  151.  
  152. if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
  153.     (echo "Usage: configure HOST" ;
  154.     echo ;
  155.     echo "Options: [defaults in brackets]" ;
  156.     echo " +ansi        configure w/ANSI library. [no ansi lib]" ;
  157.     echo " +destdir=MYDIR    configure for installation into MYDIR. [/usr/local]" ;
  158.     echo " +subdirs        configure in subdirectories.  [in source directories]" ;
  159.     echo " +lang=LANG    configure to build LANG. [gcc]" ;
  160.     echo " +help        print this message. [normal config]" ;
  161.     echo " +gas        configure the compilers for use with gas. [native as]" ;
  162.     echo " +nfp        configure the compilers default to soft floating point. [hard float]" ;
  163.     echo " +norecurse    configure this directory only. [recurse]" ;
  164.     echo " +rm        remove this configuration. [build a configuration]" ;
  165.     echo " +target=TARGET    configure for TARGET.  [TARGET = HOST]" ;
  166.     echo " +template=TEM    rebuild configure using TEM. [normal config]" ;
  167.     echo ;
  168.     echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
  169.     echo "Asking for more than one \"+target\" implies \"+subdirs\".  Any other" ;
  170.     echo "options given will apply to all targets.") 1>&2
  171.  
  172.     if [ -r config.status ] ; then
  173.         cat config.status
  174.     fi
  175.  
  176.     exit 1
  177. fi
  178.  
  179. #### configure.in common parts come in here.
  180. srcname="GDB"
  181. srctrigger=main.c
  182.  
  183. ## end of common part.
  184.  
  185. # are we rebuilding config itself?
  186. if [ -n "${template}" ] ; then
  187.     if [ ! -r ${template} ] ; then
  188.         echo '***' "Can't find template ${template}." 1>&2
  189.         exit 1
  190.     fi
  191.  
  192. # prep the template
  193.     sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\
  194. #### configure.in common parts come in here.\
  195. ## end of common part.' \
  196.     -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\
  197. #### configure.in per-host parts come in here.\
  198. ## end of per-host part.' \
  199.     -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\
  200. #### configure.in per-target parts come in here.\
  201. ## end of per-target part.' \
  202.     -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\
  203. #### configure.in post-target parts come in here.\
  204. ## end of post-target part.' \
  205.     < ${template} > template.new
  206.  
  207.     if [ -r configure.in ] ; then
  208.         if [ -z "`grep '^# per\-host:' configure.in`" ] ; then
  209.             echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2
  210.             exit 1
  211.         fi
  212.  
  213.         if [ -z "`grep '^# per\-target:' configure.in`" ] ; then
  214.             echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2
  215.             exit 1
  216.         fi
  217.  
  218.         # split configure.in into common, per-host, per-target,
  219.         # and post-target parts.  Post-target is optional.
  220.         sed -e '/^# per\-host:/,$d' configure.in > configure.com
  221.         sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst
  222.         if grep -s '^# post-target:' configure.in ; then
  223.           sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt
  224.           sed -e '1,/^# post\-target:/d' configure.in > configure.pos
  225.         else
  226.           sed -e '1,/^# per\-target:/d' configure.in > configure.tgt
  227.           echo >configure.pos
  228.         fi
  229.  
  230.         # and insert them
  231.         sed -e '/^#### configure.in common parts come in here.$/  r configure.com' \
  232.             -e '/^#### configure.in per\-host parts come in here.$/  r configure.hst' \
  233.             -e '/^#### configure.in per\-target parts come in here.$/  r configure.tgt' \
  234.             -e '/^#### configure.in post\-target parts come in here.$/  r configure.pos' \
  235.             template.new > configure.new
  236.  
  237.         rm -f configure.com configure.tgt configure.hst configure.pos
  238.     else
  239.         echo Warning: no configure.in in `pwd`
  240.         cat ${template} >> configure
  241.     fi
  242.  
  243.     chmod a+x configure.new
  244.     rm template.new
  245. #    mv configure configure.old
  246.     mv configure.new configure
  247.  
  248.     if [ -n "${verbose}" ] ; then
  249.         echo Rebuilt configure in `pwd`
  250.     fi
  251.  
  252.     # Now update config.sub from the template directory.
  253.     if echo "$template" | grep -s 'configure$' ; then
  254.         cp `echo "$template" | sed s/configure$/config.sub/` ./config.sub.new
  255.     #    mv config.sub config.sub.old
  256.         mv config.sub.new config.sub
  257.  
  258.         if [ -n "${verbose}" ] ; then
  259.             echo Rebuilt config.sub in `pwd`
  260.         fi
  261.     fi
  262.  
  263.     if [ -z "${norecurse}" ] ; then
  264.         # If template is relative path, make it absolute for recursing.
  265.         if echo "${template}" | grep -s '^/' ; then
  266.            true
  267.         else
  268.            template=`pwd`/${template}
  269.         fi
  270.  
  271.         while [ -n "${configdirs}" ] ; do
  272.             # set configdir to car of configdirs, configdirs to cdr of configdirs
  273.             set ${configdirs}; configdir=$1; shift; configdirs=$*
  274.  
  275.             if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then
  276.                 targetspecificdirs=${configdir}.*
  277.             else
  278.                 targetspecificdirs=
  279.             fi
  280.  
  281.             for i in ${configdir} ${targetspecificdirs} ; do
  282.                 if [ -d $i ] ; then
  283.                     if [ -r $i/configure ] ; then
  284.                         (cd $i ;
  285.                             ./configure +template=${template} ${verbose})
  286.                     else
  287.                         echo Warning: No configure script in `pwd`/$i
  288.                     fi
  289.                 else
  290.                     if [ -n "${verbose}" ] ; then
  291.                       echo Warning: directory $i is missing.
  292.                     fi
  293.                 fi
  294.             done
  295.         done
  296.     fi
  297.  
  298.     exit 0
  299. fi
  300.  
  301. # some sanity checks on configure.in
  302. if [ -z "${srctrigger}" ] ; then
  303.     echo Warning: srctrigger not set in configure.in. `pwd` not configured.
  304.     exit 1
  305. fi
  306.  
  307. for host in ${hosts} ; do
  308.     # Default other arg
  309.     if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
  310.         targets=${host}
  311.         defaulttargets=true
  312.     fi
  313.  
  314.     result=`/bin/sh ./config.sub ${host}`
  315.     host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  316.     host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  317.     host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  318.     host=${host_cpu}-${host_vendor}-${host_os}
  319.     host_makefile_frag=config/hmake-${host}
  320.  
  321. #### configure.in per-host parts come in here.
  322.  
  323. # map host info into gdb names.
  324.  
  325. case "${host_cpu}" in
  326.  
  327. m68k)
  328.     case "${host_vendor}" in
  329.     att)    gdb_host=3b1 ;;
  330.     altos)
  331.         case "${host_os}" in
  332.         gas)    gdb_host=altosgas ;;
  333.         *)    gdb_host=altos ;;    
  334.         esac
  335.         ;;
  336.     hp)
  337.         case ${host_os} in
  338.         hpux)    gdb_host=hp300hpux ;;
  339.         bsd)    gdb_host=hp300bsd ;;
  340.         esac
  341.         ;;
  342.  
  343.     isi)    gdb_host=isi ;;
  344.     sony)    gdb_host=news ;;
  345.     sun)
  346.         case "${host_os}" in
  347.         sunos3)    gdb_host=sun3os3 ;;
  348.         sunos4)    gdb_host=sun3os4 ;;
  349.         *)    gdb_host=sun3 ;;
  350.         esac
  351.         ;;
  352.     esac
  353.     ;;
  354.  
  355. m68000)
  356.     case "${host_vendor}" in
  357.     sun)
  358.         case "${host_os}" in
  359.         sunos3)    gdb_host=sun2os3 ;;
  360.         sunos4)    gdb_host=sun2os4 ;;
  361.         *)    gdb_host=sun2 ;;
  362.         esac
  363.     esac
  364.     ;;
  365.  
  366. sparc)
  367.     case "${host_os}" in
  368.     sunos3)    gdb_host=sun4os3 ;;
  369.     sunos4)    gdb_host=sun4os4 ;;
  370.     *)    gdb_host=sun4 ;;
  371.     esac
  372.     ;;
  373.  
  374. m68030)
  375.     case "${host_vendor}" in
  376.     sony)    gdb_host=news1000 ;;
  377.     esac
  378.     ;;
  379.  
  380. mips)
  381.     case "${host_vendor}" in
  382.     sony)    gdb_host=bigmips ;;
  383.     dec)    gdb_host=dec3100 ;;
  384.     little)    gdb_host=littlemips ;;
  385.     esac
  386.     ;;
  387.  
  388. i386)
  389.     case "${host_vendor}" in
  390.     sun)    gdb_host=sun386 ;;
  391.     sco)    gdb_host=i386sco ;;
  392.     sequent)    gdb_host=symmetry ;;
  393.     *)
  394.         case "${host_os}" in
  395.         sysv)    gdb_host=i386v ;;
  396.         sysv32)    gdb_host=i386v32 ;;
  397.         esac
  398.         ;;
  399.     esac
  400.     ;;
  401.  
  402. c1 | c2)    gdb_host=convex ;;
  403.  
  404. ns32k)
  405.     case "${host_vendor}" in
  406.     umax)    gdb_host=umax ;;
  407.     esac
  408.     ;;
  409.  
  410. arm | vax | m88k | merlin | none | np1 | pn | pyramid | tahoe)    gdb_host=${host_cpu} ;;
  411.  
  412. ### unhandled hosts
  413. #altosgas
  414. #i386v-g
  415. #i386v32-g
  416.  
  417. esac
  418.  
  419. if [ ! -f xconfig/${gdb_host} ]; then
  420.     echo '***' "Gdb does not support host ${host}" 1>&2
  421.     exit 1
  422. fi
  423.  
  424. #  We really shouldn't depend on there being a space after XM_FILE= ...
  425. hostfile=`awk '$1 == "XM_FILE=" { print $2 }' <xconfig/${gdb_host}`
  426.  
  427. ## end of per-host part.
  428.  
  429.     for target in ${targets} ; do
  430.  
  431.         result=`/bin/sh ./config.sub ${target}`
  432.         target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  433.         target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  434.         target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  435.         target=${target_cpu}-${target_vendor}-${target_os}
  436.         target_makefile_frag=config/tmake-${target}
  437.  
  438. #### configure.in per-target parts come in here.
  439.  
  440. case "${target_cpu}" in
  441.  
  442. m68k)
  443.     case "${target_vendor}" in
  444.     att)    gdb_target=3b1 ;;
  445.     altos)    gdb_target=altos ;;
  446.     hp)
  447.         case "${target_os}" in
  448.         bsd)    gdb_target=hp300bsd ;;
  449.         hpux)    gdb_target=hp300hpux ;;
  450.         esac
  451.         ;;
  452.     sun)
  453.         case "${target_os}" in
  454.         sunos3)    gdb_target=sun3os3 ;;
  455.         sunos4)    gdb_target=sun3os4 ;;
  456.         *)    gdb_target=sun3 ;;
  457.         esac
  458.         ;;
  459.     wrs)    gdb_target=vxworks68 ;;
  460.     isi)    gdb_target=isi ;;
  461.     sony)    gdb_target=news ;;
  462.     esac
  463.     ;;
  464.  
  465. m68000)
  466.     case "${target_vendor}" in
  467.     sun)
  468.         case "${target_os}" in
  469.         sunos3)    gdb_target=sun2os3 ;;
  470.         sunos4)    gdb_target=sun2os4 ;;
  471.         *)    gdb_target=sun2 ;;
  472.         esac
  473.     esac
  474.     ;;
  475.  
  476. m68030)
  477.     case "${target_vendor}" in
  478.     sony)    gdb_target=news1000 ;;
  479.     esac
  480.     ;;
  481.  
  482. none | tahoe | vax | np1 | pn | np1 | pn | pyramid | merlin | m88k)
  483.     gdb_target=${target_cpu} ;;
  484. a29k)    gdb_target=am29k ;;
  485. arm)    gdb_target=${target_cpu} ;;
  486.  
  487. mips)
  488.     case "${target_vendor}" in
  489.     sony)    gdb_target=bigmips ;;
  490.     dec)    gdb_target=dec3100 ;;
  491.     little)    gdb_target=littlemips ;;
  492.     esac
  493.     ;;
  494.  
  495. c1 | c2)    gdb_target=convex ;;
  496.  
  497. sparc)
  498.     case "${target_vendor}" in
  499.     sun)
  500.         case "${target_os}" in
  501.         sunos3)    gdb_target=sun4os3 ;;
  502.         sunos4)    gdb_target=sun4os4 ;;
  503.         *)    gdb_target=sun4 ;;
  504.         esac
  505.         ;;
  506.     esac
  507.     ;;
  508.  
  509.  
  510. i386)
  511.     case "${target_vendor}" in
  512.     sco)    gdb_target=i386sco ;;
  513.     sun)    gdb_target=sun386 ;;
  514.     sequent)    gdb_target=symmetry ;;
  515.     coff)    gdb_target=i386v ;;
  516.     aout)    gdb_target=i386v ;;
  517.     *)
  518.         case "${target_os}" in
  519.         sysv)    gdb_target=i386v ;;
  520.         sysv32)    gdb_target=i386v32 ;;
  521.         esac
  522.     esac
  523.     ;;
  524.  
  525. i960)
  526.     case "${target_vendor}" in
  527.     bout | wrs)    gdb_target=vxworks960 ;;
  528.     coff | intel)    gdb_target=nindy960 ;;
  529.     esac
  530.     ;;
  531.  
  532. ns32k)
  533.     case "${target_vendor}" in
  534.     utek)    gdb_target=umax ;;
  535.     esac
  536.     ;;
  537.  
  538. ### unhandled targets
  539. # altosgas
  540. # i386v-g
  541. # i386v32-g
  542.  
  543. esac
  544.  
  545. if [ ! -f tconfig/${gdb_target} ]; then
  546.     echo '***' "Gdb does not support target ${target}" 1>&2
  547.     exit 1
  548. fi
  549.  
  550. if [ -z "${removing}" ] ; then
  551.     cat xconfig/${gdb_host} tconfig/${gdb_target} | awk '$1 == "#msg" {
  552.         print substr($0,6)}'
  553. fi
  554.  
  555. #  We really shouldn't depend on there being a space after TM_FILE= ...
  556. targetfile=`awk '$1 == "TM_FILE=" { print $2 }' <tconfig/${gdb_target}`
  557.  
  558. host_makefile_frag=xconfig/${gdb_host}
  559. target_makefile_frag=tconfig/${gdb_target}
  560.  
  561. # If hostfile (XM_FILE) and/or targetfile (TM_FILE) is not set in the
  562. # ?config/* file, we don't make the corresponding links.  But we have
  563. # to remove the xm.h files and tm.h files anyway, e.g. when switching
  564. # from "configure host" to "configure none".
  565. files=
  566. links=
  567. rm -f xm.h
  568. if [ "${hostfile}" != "" ]; then
  569.     files="${files} ${hostfile}"
  570.     links="${links} xm.h"
  571. fi
  572. rm -f tm.h
  573. if [ "${targetfile}" != "" ]; then
  574.     files="${files} ${targetfile}"
  575.     links="${links} tm.h"
  576. fi
  577.  
  578. ## end of per-target part.
  579.  
  580.         # Temporarily, we support only direct subdir builds.
  581.         hostsubdir=Host-${host}
  582.         targetsubdir=Target-${target}
  583.  
  584.         if [ -n "${removing}" ] ; then
  585.             if [ -n "${subdirs}" ] ; then
  586.                 if [ -d "${hostsubdir}" ] ; then
  587.                     rm -rf ${hostsubdir}/${targetsubdir}
  588.  
  589.                     if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target- | grep -v Target-independent`" ] ; then
  590.                         rm -rf ${hostsubdir}
  591.                     fi
  592.                 else
  593.                     echo Warning: no `pwd`/${hostsubdir} to remove.
  594.                 fi
  595.             else
  596.                 rm -f ${Makefile} config.status ${links}
  597.             fi
  598.         else
  599.             if [ -n "${subdirs}" ] ; then
  600.                 # check for existing status before allowing forced subdirs.
  601.                 if [ -f ${Makefile} ] ; then
  602.                     echo '***' "${Makefile} already exists in source directory.  `pwd` not configured." 1>&2
  603.                     exit 1
  604.                 fi
  605.  
  606.                 if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi
  607.                 cd ${hostsubdir}
  608.  
  609.                 if [ ! -d ${targetsubdir} ] ; then
  610.                     if [ -z "${commontargets}" ] ; then
  611.                         mkdir ${targetsubdir}
  612.                     else
  613.                         if [ ! -d Target-independent ] ; then
  614.                             mkdir Target-independent
  615.                         fi
  616.  
  617.                         ${symbolic_link} Target-independent ${targetsubdir}
  618.                     fi # if target independent
  619.                 fi # if no target dir yet
  620.  
  621.                 cd ${targetsubdir}
  622.  
  623.                 srcdir=../..
  624.             else
  625.                 # if not subdir builds, then make sure none exist.
  626.                 if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then
  627.                     echo '***' "Configured subdirs exist.  `pwd` not configured." 1>&2
  628.                     exit 1
  629.                 fi
  630.             fi
  631.  
  632.             # Find the source files, if location was not specified.
  633.             if [ -z "${srcdir}" ] ; then
  634.                 srcdirdefaulted=1
  635.                 srcdir=.
  636.                 if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then
  637.                     srcdir=..
  638.                 fi
  639.             fi
  640.  
  641.             if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then
  642.                 if [ -z "${srcdirdefaulted}" ] ; then
  643.                     echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2
  644.                 else
  645.                     echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2
  646.                 fi
  647.  
  648.                 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
  649.                 exit 1
  650.             fi
  651.  
  652.             # Set up the list of links to be made.
  653.             # ${links} is the list of link names, and ${files} is the list of names to link to.
  654.  
  655.             # Make the links.
  656.             while [ -n "${files}" ] ; do
  657.                 # set file to car of files, files to cdr of files
  658.                 set ${files}; file=$1; shift; files=$*
  659.                 set ${links}; link=$1; shift; links=$*
  660.  
  661.                 if [ ! -r ${srcdir}/${file} ] ; then
  662.                     echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
  663.                     echo '***' "since the file \"${file}\" does not exist." 1>&2
  664.                     exit 1
  665.                 fi
  666.  
  667.                 ${remove} -f ${link}
  668.                 rm -f config.status
  669.                 # Make a symlink if possible, otherwise try a hard link
  670.                 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
  671.  
  672.                 if [ ! -r ${link} ] ; then
  673.                     echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
  674.                     exit 1
  675.                 fi
  676.  
  677.                 if [ -n "${verbose}" ] ; then
  678.                     echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
  679.                 fi
  680.             done
  681.  
  682.             # Create a .gdbinit file which runs the one in srcdir
  683.             # and tells GDB to look there for source files.
  684.  
  685.             case ${srcdir} in
  686.             .)
  687.                 ;;
  688.             *)
  689.                 echo "dir ." > .gdbinit
  690.                 echo "dir ${srcdir}" >> .gdbinit
  691.                 echo "source ${srcdir}/.gdbinit" >> .gdbinit
  692.                 ;;
  693.             esac
  694.  
  695.             # Install a makefile, and make it set VPATH
  696.             # if necessary so that the sources are found.
  697.             # Also change its value of srcdir.
  698.  
  699.         # FIXME-someday: This business of always writing to .tem and mv back
  700.         # is so that I don't screw things up while developing.  Once this
  701.         # template is stable, these should be optimized. xoxorich.
  702.  
  703.             # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
  704.             if [ "${host}" != "${target}" ] ; then
  705.                 echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
  706.                 echo "ALL=start.encap" >> ${Makefile}
  707.             else
  708.                 echo "ALL=all.internal" > ${Makefile}
  709.             fi
  710.  
  711.             # set target, host, VPATH
  712.             echo "host = ${host}" >> ${Makefile}
  713.             echo "target = ${target}" >> ${Makefile}
  714.  
  715.             if [ -n "${subdirs}" ] ; then
  716.                 echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile}
  717.             else
  718.                 echo "subdir =" >> ${Makefile}
  719.             fi
  720.  
  721.         #    echo "workdir = `pwd`" >> ${Makefile}
  722.             echo "VPATH = ${srcdir}" >> ${Makefile}
  723.  
  724.             # add "Makefile.in" (or whatever it's called)
  725.             cat ${srcdir}/${Makefile_in} >> ${Makefile}
  726.  
  727.             # Conditionalize the makefile for this host.
  728.             if [ -f ${srcdir}/${host_makefile_frag} ] ; then
  729.                 sed -e "/^####/  r ${srcdir}/${host_makefile_frag}" ${Makefile} > Makefile.tem
  730.                 mv Makefile.tem ${Makefile}
  731.             fi
  732.  
  733.             # Conditionalize the makefile for this target.
  734.             if [ -f ${srcdir}/${target_makefile_frag} ] ; then
  735.                 sed -e "/^####/  r ${srcdir}/${target_makefile_frag}" ${Makefile} > Makefile.tem
  736.                 mv Makefile.tem ${Makefile}
  737.             fi
  738.  
  739.             # set srcdir
  740.             sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
  741.             mv Makefile.tem ${Makefile}
  742.  
  743.             # set destdir
  744.             if [ -n "${destdir}" ] ; then
  745.                 sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem
  746.                 mv Makefile.tem ${Makefile}
  747.             fi
  748.  
  749.             # reset SUBDIRS
  750.             sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
  751.             mv Makefile.tem ${Makefile}
  752.  
  753.             # reset NONSUBDIRS
  754.             sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
  755.             mv Makefile.tem ${Makefile}
  756.  
  757.             using=
  758.             if [ -f ${srcdir}/${host_makefile_frag} ] ; then
  759.                 using=" using \"${host_makefile_frag}\""
  760.             fi
  761.  
  762.             if [ -f ${srcdir}/${target_makefile_frag} ] ; then
  763.                 if [ -z "${using}" ] ; then
  764.                     andusing=" using \"${target_makefile_frag}\""
  765.                 else
  766.                     andusing="${using} and \"${target_makefile_frag}\""
  767.                 fi
  768.             else
  769.                 andusing=${using}
  770.             fi
  771.  
  772.             if [ -n "${verbose}" -o -z "${recursing}" ] ; then
  773.                 echo "Created \"${Makefile}\"" in `pwd`${andusing}.
  774.             fi
  775.  
  776. #### configure.in post-target parts come in here.
  777.  
  778. case ${srcdir} in
  779.   .)
  780.     ;;
  781.   *)
  782.     grep -s "source ${srcdir}/.gdbinit" .gdbinit 2>/dev/null || \
  783.       echo "source ${srcdir}/.gdbinit" >> .gdbinit
  784. esac
  785.  
  786. cat ${srcdir}/alldeps.mak ${srcdir}/depend >>Makefile
  787. ## end of post-target part.
  788.  
  789.             if [ "${host}" = "${target}" ] ; then
  790.                 echo "Links are now set up for use with a ${target}." \
  791.                     > config.status
  792.         #            | tee ${srcdir}/config.status
  793.             else
  794.                 echo "Links are now set up for host ${host} and target ${target}." \
  795.                     > config.status
  796.         #            | tee ${srcdir}/config.status
  797.             fi
  798.  
  799.             originaldir=`pwd`
  800.             cd ${srcdir}
  801.         fi
  802.  
  803.         # If there are subdirectories, then recurse. 
  804.         if [ -z "${norecurse}" -a -n "${configdirs}" ] ; then 
  805.             for configdir in ${configdirs} ; do
  806.                 if [ -n "${verbose}" ] ; then
  807.                     echo Configuring ${configdir}...
  808.                 fi
  809.  
  810.                 if [ -d ${configdir} ] ; then
  811.                     (cd ${configdir} ;
  812.                         ./configure -recursing ${host} +target=${target} \
  813.                             ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \
  814.                         | sed 's/^/    /'
  815.                 else
  816.                     if [ -n "${verbose}" ] ; then
  817.                         echo Warning: directory \"${configdir}\" is missing.
  818.                     fi
  819.                 fi
  820.             done
  821.         fi
  822.     done # for each target
  823.  
  824.     # Now build a Makefile for this host.
  825.     if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
  826.         cd ${hostsubdir}
  827.         cat > GNUmakefile << E!O!F
  828. # Makefile generated by configure for host ${host}.
  829.  
  830. ALL := $(shell ls -d Target-*)
  831.  
  832. %:
  833.     $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
  834.  
  835. all:
  836. E!O!F
  837.         cd ..
  838.     fi
  839. done # for each host
  840.  
  841. exit 0
  842.  
  843. #
  844. # $Log: configure,v $
  845. # Revision 1.31  1991/08/23  04:50:57  rich
  846. # Minor config polish.
  847. #
  848. # Revision 1.22  1991/08/23  03:31:43  rich
  849. # Minor polish & config mapping.
  850. #
  851. # Revision 1.30  1991/08/22  07:15:51  rich
  852. # Three part names, etc.
  853. #
  854. # Revision 1.29  1991/08/20  04:56:51  rich
  855. # revisiting error messages
  856. #
  857. # Revision 1.28  1991/08/16  19:22:17  rich
  858. # This is the commontargets change and should be considered
  859. # experimental.
  860. #
  861. # Revision 1.27  1991/08/08  01:14:13  rich
  862. # allow +f to stand in for +subdirs
  863. #
  864. # Revision 1.26  1991/08/07  19:21:32  rich
  865. # +forcesubdirs -> +subdirs
  866. #
  867. # Revision 1.25  1991/08/07  07:05:30  rich
  868. # Added make.
  869. #
  870. # Revision 1.24  1991/08/06  19:26:01  rich
  871. # revised option parsing.
  872. #
  873. # Revision 1.23  1991/08/06  19:12:32  rich
  874. # Host-level GNUmakefiles.
  875. #
  876. # Revision 1.22  1991/07/20  01:22:30  rich
  877. # propogate gdb changes and destdir fix
  878. #
  879. # Revision 1.21  1991/07/20  00:55:20  gnu
  880. # Roll in new configure that handles GDB.  Make sure that the "configure"
  881. # that is checked-in reflects the latest "configure.in", which includes gdb.
  882. #
  883. # Revision 1.9  1991/07/06  04:35:51  gnu
  884. # Fix bug in configure when iterating targets.
  885. # Depend on alldeps.mak, not ${srcdir}/alldeps.mak, so it can be found
  886. # in either spot.
  887. #
  888. # Revision 1.8  1991/07/05  00:04:58  gnu
  889. # Thu Jul  4 14:47:06 1991  John Gilmore  (gnu at cygint.cygnus.com)
  890. #
  891. #         * configure.in, Makefile.in:  Avoid rebuilding "depend" as much.
  892. #         Avoid declaring Makefile dependencies, because GNU Make stupidly
  893. #         tries to update it if we do.
  894. #
  895. #         * coffread.c:  Revise for minor changes to bfd internal coff
  896. #         indexes.
  897. #
  898. #         * configure:  If -template= is given a relative path, make it
  899. #         absolute before recurring in subdirectories.
  900. #
  901. # Revision 1.7  1991/07/04  15:59:46  gnu
  902. # Make gdb work with configure.  Only thing that doesn't work is the -list
  903. # option (as far as I know).
  904. #
  905. # Revision 1.6  1991/06/04  07:28:16  gnu
  906. # Change GDB over to GNU General Public License version 2.
  907. #
  908. # Revision 1.5  1991/05/19  07:26:54  rich
  909. # configure changes and -opcode.h movement.
  910. #
  911. # Revision 1.4  1991/05/19  00:16:45  rich
  912. # Configure for gdb.
  913. #
  914. # Revision 1.10  1991/05/04  00:58:38  rich
  915. # Fix program name bug.
  916. #
  917. # Revision 1.9  1991/05/03  19:14:18  rich
  918. # Changed getopt to libiberty, commented out an aborted attempt at host
  919. # level Makefiles because it caused errors on +rm, add a warning for
  920. # directories expected to be removed on +rm but that don't exist.
  921. #
  922. # Revision 1.8  1991/04/24  16:50:59  rich
  923. # Three staging checkpoint.
  924. #
  925. # Revision 1.7  1991/04/17  01:34:47  rich
  926. # Added getopt for binutils, fixed problem with host dependancies in
  927. # configure.template.
  928. #
  929. # Revision 1.6  1991/04/16  00:18:44  rich
  930. # Now handles multiple hosts and targets.
  931. #
  932. # Revision 1.5  1991/04/15  23:43:44  rich
  933. # Now handles multiple hosts and targets.
  934. #
  935. # Revision 1.4  1991/04/13  02:11:03  rich
  936. # Config cut 3.  We now almost install a29k.
  937. #
  938. # Revision 1.3  1991/04/11  02:41:54  rich
  939. # Cut 2 config.  Subdirs.
  940. #
  941. #
  942. #
  943.  
  944. #
  945. # Local Variables:
  946. # fill-column: 131
  947. # End:
  948. #
  949.  
  950. # end of configure.template
  951.